﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Mask;
using DevExpress.Utils;
using DevExpress.XtraEditors.Repository;

namespace ThuVienTNN
{
    public static class CauHinhTextEdit
    {
        /// <summary>
        /// dat mat na cho textEdit
        /// </summary>
        /// <param name="textEdit"></param>
        /// <param name="maskType"></param>
        /// <param name="maskString"></param>
        public static void Config(this TextEdit textEdit, MaskType maskType = MaskType .RegEx, string maskString = null, int maxLength = 15)
        {
            textEdit.Properties.Mask.UseMaskAsDisplayFormat = true;
            textEdit.Properties.Mask.EditMask = maskString;
            textEdit.Properties.Mask.MaskType = maskType;
            textEdit.Properties .MaxLength = maxLength;
        }
        public static void Config(this RepositoryItemTextEdit textEdit, MaskType maskType = MaskType .RegEx, string maskString = null, int maxLength=15)
        {
            textEdit.Mask.UseMaskAsDisplayFormat = true;
            textEdit.Mask.EditMask = maskString;
            textEdit.Mask.MaskType = maskType;
            textEdit.MaxLength = maxLength;
        }
    }
}
